package models

import (
	"github.com/gin-gonic/gin"
	"net/http"
)

type FeedResponse struct {
	Response
	NextTime  int64   `json:"next_time"`
	VideoList []Video `json:"video_list"`
}

// ResponseFeedSuccess 发布的视频列表成功
func ResponseFeedSuccess(c *gin.Context, videoList []Video, nextTime int64) {
	c.JSON(http.StatusOK, &FeedResponse{
		Response:  Response{StatusCode: CodeSuccess, StatusMsg: ResCode.Msg(CodeSuccess)},
		NextTime:  nextTime,
		VideoList: videoList,
	})
}

// ResponseFeedError 发布的视频列表错误
func ResponseFeedError(c *gin.Context, code ResCode) {
	c.JSON(http.StatusOK, &FeedResponse{
		Response:  Response{StatusCode: code, StatusMsg: code.Msg()},
		NextTime:  0,
		VideoList: nil,
	})
}
